#include "fonctions.h"

char * recup1erArgument (char * cmd)
{
	int debut =0, fin;
	char * retour;
	while(debut < strlen(cmd) && cmd[debut] != ' ')
	{
		debut++;
	}
	debut++;
	fin = debut;
	
	while(fin < strlen(cmd) && (cmd[fin] != ' ' && cmd[fin] != '\n' && cmd[fin] != '\0'))
	{
		fin++;
	}
	
	retour = malloc(sizeof(char)*(fin-debut +1));
	retour = memcpy ( retour, &(cmd[debut]), (fin-debut +1));
	
	return retour;
}

